import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: () => import('@/views/Home.vue')
    },
    // 点群路由
    {
      path: '/point-groups',
      name: 'PointGroups',
      component: () => import('@/views/PointGroups.vue')
    },
    {
      path: '/point-groups/:groupId',
      name: 'PointGroupDetail',
      props: true,
      component: () => import('@/views/PointGroupDetail.vue')
    },
    // 空间群路由
    {
      path: '/space-groups',
      name: 'SpaceGroups',
      component: () => import('@/views/SpaceGroups.vue')
    },
    {
      path: '/space-groups/:groupId',
      name: 'SpaceGroupDetail',
      props: true,
      component: () => import('@/views/SpaceGroupDetail.vue')
    },
    // 磁性空间群路由
    {
      path: '/magnetic-groups',
      name: 'MagneticGroups',
      component: () => import('@/views/MagneticGroups.vue')
    },
    {
      path: '/magnetic-groups/:groupId',
      name: 'MagneticGroupDetail',
      props: true,
      component: () => import('@/views/MagneticGroupDetail.vue')
    },
    // 自旋空间群路由
    {
      path: '/spin-groups',
      name: 'SpinGroups',
      component: () => import('@/views/SpinGroups.vue')
    },
    {
      path: '/spin-groups/:groupId',
      name: 'SpinGroupDetail',
      props: true,
      component: () => import('@/views/SpinGroupDetail.vue')
    },
    // 404 页面
    {
      path: '/:pathMatch(.*)*',
      name: 'NotFound',
      component: () => import('@/views/NotFound.vue')
    }
  ],
  scrollBehavior: () => ({ top: 0, behavior: 'smooth' })
})

export default router
